using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Web.UI;
using System.Web.UI.Adapters;

namespace OpenWaves.ActivityFeed.Web.Controls
{
    [SuppressMessage("Microsoft.Naming", "CA1722:Identifiers should not have incorrect prefix")]
    public class CDataKnockoutJSTemplateAdapter : ControlAdapter
    {
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteLine(String.Format(CultureInfo.InvariantCulture, "<!-- Using CDataKnockoutJSTemplateAdapter to render {0}. -->", this.Control.ID));
            writer.Write(String.Format(CultureInfo.InvariantCulture, "<script id=\"{0}\" type=\"text/html\"><![CDATA[", this.Control.ClientID));
            base.RenderChildren(writer);
            writer.WriteLine("]]></script>");
        }
    }
}